package com.doit.zhaohang.handlerlunbotu;

import android.content.Context;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.util.List;

/**
 * Created by 赵航 on 2017/5/19.
 */

public class ADbar extends RelativeLayout {

    private ViewPager mViewPager;
    private TextView mTextView;
    private LinearLayout mLinearLayout;
    private Context mContext;

    public ADbar(Context context) {
        this(context,null);
    }

    public ADbar(Context context, AttributeSet attrs) {
        super(context, attrs);
        /*1.编写布局
        *2.把控件转化为一个view，并添加到控件中
        *
        * 3fbc找到各个控件
        *
        *
        * */
        LayoutInflater.from(context).inflate(R.layout.adbar_layout, this, true);
        mViewPager = (ViewPager) findViewById(R.id.viewpager);
        mTextView = (TextView) findViewById(R.id.text);
        mLinearLayout = (LinearLayout) findViewById(R.id.linerda);
        mContext = context;

    }

    public ADbar(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public ADbar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        this(context, attrs);
    }

    public void setData( List<Integer> arr, List<String> brr) {

        initViewPager(arr);
        initDos(arr);
    }

    private void initDos( List<Integer> arr) {

        Adapter adapter = new Adapter(getContext(),arr);

        mViewPager.setAdapter(adapter);
    }

    private void initViewPager(List<Integer> arr) {


    }

}
